/**
* 产品 列表 模块 组建
*/
<template>
    <div class="h-news">
      <!-- 产品 图 -->
      <product-serie v-for="item in newData" :productData="item" :key="item.id"></product-serie>
    </div>
</template>
<script>
//import { newList } from '@/mock' // 新品数据
import { newsData } from '@/api'
import ProductSerie from '@/components/ProductSerie'

export default {
  name: 'List',
  components: { ProductSerie },
  props: {},
  data () {
    return {
      id:this.$route.params.id,
      type:this.$route.params.type,
      newData: [],
    }
  },
  created () {
     this.getNewsData() // 新品数据加载
  },
  mounted () {
   // this.getNewsData() // 新品数据加载
  },
  watch: {
      '$route' (to, from) {
          this.type=to.params.type;
          this.id=to.params.id;
          if (to.path != from.path ) {
              // eslint-disable-next-line no-debugger
            //  debugger
            this.getNewsData() // 新品数据加载
          }
        }
  },
  methods: {
    getNewsData () {
      const params = { // 请求参数 --- 根据情况 是否需要
       type:this.type, id: this.id
      }
      newsData(params).then(res => {
        this.newData = res
      })
    }
  },
}
</script>

<style lang="scss" scoped>
    .h-news {
      margin-bottom: 20px;
          min-height: 700px;
      .h-banner{
        width: 100%;
        height: 400px;
        margin-bottom: 20px;
      }
    }
</style>
